//
//  AllEvaluateHeadV.m
//  FKGW
//
//  Created by song ce on 2017/3/15.
//  Copyright © 2017年 song ce. All rights reserved.
//

#import "AllEvaluateHeadV.h"
#import "UIView+Extend.h"
@implementation AllEvaluateHeadV

- (void)awakeFromNib {
    [super awakeFromNib];
    self.width = Main_Screen_Width;
}
//全部评价
- (IBAction)allBtn:(UIButton *)sender {
    if(self.evaluateBlock){
        self.evaluateBlock(3);
    }
    [self selectedBtn:sender];
    [self resetBtn:self.haopingBtn];
    [self resetBtn:self.zhongpingBtn];
    [self resetBtn:self.chapingBtn];
}
//好评
- (IBAction)haopingBtn:(UIButton *)sender {
    if(self.evaluateBlock){
        self.evaluateBlock(0);
    }
    [self selectedBtn:sender];
    [self resetBtn:self.allBtn];
    [self resetBtn:self.zhongpingBtn];
    [self resetBtn:self.chapingBtn];
  }
//中评
- (IBAction)zhongpingBtn:(UIButton *)sender {
    if(self.evaluateBlock){
        self.evaluateBlock(1);
    }
    [self selectedBtn:sender];
    [self resetBtn:self.allBtn];
    [self resetBtn:self.haopingBtn];
    [self resetBtn:self.chapingBtn];
    }
//差评
- (IBAction)chapingBtn:(UIButton *)sender {
    if(self.evaluateBlock){
        self.evaluateBlock(2);
    }
    [self selectedBtn:sender];
    [self resetBtn:self.allBtn];
    [self resetBtn:self.zhongpingBtn];
    [self resetBtn:self.haopingBtn];

}
//设置当前选中按钮的状态
- (void)selectedBtn:(UIButton*)sender{
    [sender setTitleColor:DEF_COLOR forState:UIControlStateNormal];
    [sender setBackgroundImage:[UIImage imageNamed:@"shangpinpingjia_sel"] forState:UIControlStateNormal];
}
//设置之前选中按钮的状态
- (void)resetBtn:(UIButton*)sender{
    [sender setTitleColor:DEF_COLOR153 forState:UIControlStateNormal];
    [sender setBackgroundImage:[UIImage imageNamed:@"shangpinpingjia_nor"] forState:UIControlStateNormal];
}

@end
